Human edit :

  1. KV SCHEMA - completed.

  2. 8 KV pairs - we skip everything about trainer profile template for now. CSS not designed.

  3. TEMPLATE VARIABLES - Proforma invoice and course schedule done. Trainer template future build.

  4. Phase 3 COMPLETE — D1 migration + worker scaffold committed and pushed.

  5. Phase 4 COMPLETE — Worker rewrite committed and pushed.

  6. KNOWN ISSUE — Route claritysystems.work/* blocked the static Eleventy site. Removed. Worker currently has NO route on main domain. newrise.claritysystems.work/* route is set and correct.

  7. PENDING before worker is live on main domain: A. Worker secrets in CF dashboard (trainingbiz-admin-clerk > Settings > Variables):

  8. Phase 5 COMPLETE — Form routing fixed, grant claim payload aligned.

  9. Phase 5 — Route + Worker debugging log (2026-05-02)

PROBLEM 1: forms returning "something went wrong" ROOT CAUSE: cac-corporate-enquiry worker deleted. Forms pointed at it. FIX: update worker_url in both forms to trainingbiz-admin-clerk.

PROBLEM 2: 403 on workers.dev URL ROOT CAUSE: Cloudflare Access was enabled on the worker (zero-trust toggle ON). FIX: disabled Cloudflare Access toggle in Worker settings. Purged cache.

PROBLEM 3: 404 from worker ROOT CAUSE: worker looked up domain:{host} in KV. Host was workers.dev URL, not claritysystems.work. KV key doesn't exist for workers.dev host. DECISION: Option B — scoped routes on claritysystems.work (not a KV workaround key). FIX:

PROBLEM 4: GitHub Actions failed to register routes ROOT CAUSE: CLOUDFLARE_API_TOKEN missing Zone → Worker Routes → Edit permission. FIX: edited token in CF dashboard → added Zone:Edit + Worker Routes:Edit for all zones. Re-ran job.

PROBLEM 5: 500 — TypeError: newBrowser is not a method ROOT CAUSE: commit 90bba7b removed puppeteer import but changed launch call to env.BROWSER.newBrowser() which is not valid API. FIX:

BINDINGS CONFIRMED ON trainingbiz-admin-clerk:

  1. Phase 5 REMAINING — test and verify end-to-end: A. Submit corporate enquiry form → verify email received with 3 PDFs attached B. Submit grant claim form → verify email received with PDFs attached C. Verify D1 enquiries table has the row written D. Verify Telegram notification received E. Verify invoice counter incremented in KV (invoice:last_number) F. Purge Cloudflare cache after confirming forms work (in case stale HTML is served) G. Update CAS_ARCHITECTURE.md to reflect Phase 3+4+5 decisions (deferred, do in dedicated session)